<?php
/**
* @package Scribble
* @subpackage Skeleton
*/
class ScribbleTemplate_sampleInner extends ScribbleTemplate implements IScribbleTemplate {

	/**
	* @param array Content of $_POST
	* @return mixed
	*/
	public function gatherPopulatorData(PageModel $page, $data=array()) {
		$data = $data['inner'];
		$content = new StdClass();
		$content->contentprimary = $data['contentprimary'];
		return $data;
	}

	/**
	* Return the View that gets rendered in the front-end of the website.
	*
	* Rather than call this method directly, it is recommended to go through
	* $page->getFrontEndView() which will manipulate the resulting View to provide
	* a few useful properties.
	*
	* This MUST return an instance of the ScribblePublicView class.
	*
	* @param PageModel Page whose content will be used during view generation
	* @return ScribblePublicView
	*/
	public function getFrontEndView(PageModel $page) {
		$view = new ScribblePublicView();
		$view->setSource(dirname(__FILE__).'/front-end.tpl.php');
		$view->baseUrl = $this->getBaseUrl();
		$view->page = $page;
		return $view;
	}

	/**
	* Return a long description of this template; the features it offers and the
	* design elements it uses.
	*
	* @return string
	*/
	public function getLongDescription() {
		return "Sample inner template";
	}

	/**
	* @param PageModel Page from which content can be pulled to pre-populate the form
	* @return ScribbleAdminView
	*/
	public function getPopulatorView(PageModel $page) {
		$view = new ScribbleAdminView();
		$view->setSource(dirname(__FILE__).'/populator.tpl.php');
		$view->baseUrl = $this->getBaseUrl();
		$view->page = $page;
		return $view;
	}

	/**
	* Return a short description of this template to aid content authors in
	* choosing the appropriate template for a Page.
	*
	* @return string
	*/
	public function getShortDescription() {
		return "Sample inner template";
	}

	/**
	* Return the title of this template (a human friendly name for this template.)
	*
	* @return string
	*/
	public function getTitle() {
		return "Sample: Inner template";
	}

	/**
	* Return this template's type, one of the following values:
	* ScribbleTemplate::TYPE_INNER
	* ScribbleTemplate::TYPE_OUTER
	*
	* @return int
	*/
	public function getType() {
		return self::TYPE_INNER;
	}

	/**
	* Validates the content in the given $page and returns the result. Any
	* informational/error messages are added to the $messages array.
	*
	* Depending on this template's type, the "innercontent" or "outercontent"
	* field of $page will need to be validated here.
	*
	* @param PageModel Page whose content will be validated
	* @param array Any error messages will be added to this array
	* @return bool
	*/
	public function validatePageContent(PageModel $page, &$messages) {
		return TRUE;
	}
}
?>